﻿
<style>
	/* qrcode */
	#qrcode > canvas {
		width: 30%;
	}
</style>

<div id="main-wrapper">
	<h1>
		<i class="glyphicon glyphicon-home"></i>查看讲座
	</h1>
	<ul class="list-group">
		<li class="list-group-item">
			<span class="li-label">讲座名称</span>
			<span id="lectname"></span>
		</li>
		<li class="list-group-item">
			<span class="li-label">讲座序列号</span>
			<span id="lectkey"></span>
		</li>
		<li class="list-group-item">
			<span class="li-label">二维码</span>
			<span id="qrcode"></span>
		</li>
	</ul>
	<div class="btn-group-vertical">
		<button href="#/audience" class="btn btn-default btn-lg btn-block">
			<i class="glyphicon glyphicon-th-list"></i>听众列表
		</button>
		<button href="#/share" class="btn btn-default btn-lg btn-block">
			<i class="glyphicon glyphicon-file"></i>文件共享
		</button>
		<button href="#/qna" class="btn btn-default btn-lg btn-block">
			<i class="glyphicon glyphicon-question-sign"></i>讲座提问
		</button>
		<button href="#/votes" class="btn btn-default btn-lg btn-block">
			<i class="glyphicon glyphicon-list-alt"></i>讲座投票
		</button>
		<button href="#/lotterys" class="btn btn-default btn-lg btn-block">
			<i class="glyphicon glyphicon-th"></i>讲座抽奖
		</button>
		<button id="btn-exit" class="btn btn-danger btn-lg btn-block">
			<i class="glyphicon glyphicon-record"></i>退出讲座
		</button>
	</div>
</div>



<!-- js -->
<script>
	$.get('/do/a/me', function(resObj) {
		var audiName = resObj['audiName'];
		$navbar.find('#username').text(audiName);
	});

	$.get('/do/a/view', function(resObj) {
		var lectkey = resObj['lectkey'],
			lectname = resObj['lectname'];
		$('#lectkey').text(lectkey);
		$('#lectname').text(lectname);
		$('#qrcode').qrcode({
			width: 256, height: 256,
			text: hostUrl + '/a/#/join?key=' + lectkey
		});
	});

	$('#btn-exit').on('click', function(){
		ajax({
			url: '/do/a/exit',
			success: function(res) {
				if (res['ok']) $window.trigger('leave_lecture');
			}
		});
	});
</script>
